-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
50 lines (43 loc) · 1.17 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"io/ioutil"
log "github.com/Sirupsen/logrus"
"github.com/alvaroloes/sdkgen/gen"
"github.com/alvaroloes/sdkgen/parser"
"github.com/juju/errors"
)
func main() {
log.SetLevel(log.DebugLevel)
// This will be extracted from command line flags
//config := gen.Config{
// APIName: "GoogleBooks",
// APIPrefix: "GOB",
// ModelsRelPath: "Models",
// ServicesRelPath: "Services",
// OutputDir: "../../../../../SDKGenDemo/SDKGenDemo/GoogleBooks/",
//}
//
//specBytes, err := ioutil.ReadFile("../../../../../SDKGenDemo/SDKGenDemo/GoogleBooks/api.sas")
config := gen.Config{
APIName: "Test",
APIPrefix: "TT",
ModelsRelPath: "Models",
ServicesRelPath: "Services",
OutputDir: "./testFiles",
}
specBytes, err := ioutil.ReadFile("./testFiles/api.sas")
if err != nil {
log.Fatal(errors.Annotate(err, "when reading API spec file"))
}
api, err := parser.NewAPI(specBytes)
if err != nil {
log.Fatal(errors.ErrorStack(err))
}
gen, err := gen.New(gen.ObjC, api, config)
if err != nil {
log.Fatal(errors.ErrorStack(err))
}
if err := gen.Generate(); err != nil {
log.Fatal(errors.ErrorStack(err))
}
}