Skip to content

Commit 7b3691f

Browse files
authored
Merge pull request #43 from stefannica/custom-cli
Customized goa CLI code generator
2 parents 051f6df + a2b6f3b commit 7b3691f

File tree

6 files changed

+1144
-4
lines changed

6 files changed

+1144
-4
lines changed

cmd/fuseml_core-cli/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
cli "github.com/fuseml/fuseml-core/gen/http/cli/fuseml_core"
10-
"github.com/goccy/go-yaml"
10+
yaml "github.com/goccy/go-yaml"
1111
goahttp "goa.design/goa/v3/http"
1212
goa "goa.design/goa/v3/pkg"
1313
)
@@ -54,7 +54,7 @@ func responseDecoder(resp *http.Response) goahttp.Decoder {
5454
case ct == "", ct == "application/x-yaml", ct == "text/x-yaml":
5555
fallthrough
5656
case strings.HasSuffix(ct, "+yaml"):
57-
return yaml.NewDecoder(resp.Body)
57+
return yaml.NewDecoder(resp.Body, yaml.Strict())
5858
default:
5959
return goahttp.ResponseDecoder(resp)
6060
}

cmd/fuseml_core-cli/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package main
22

33
import (
44
"context"
5-
"encoding/json"
65
"flag"
76
"fmt"
87
"net/url"
98
"os"
109
"strings"
1110

11+
"github.com/goccy/go-yaml"
12+
1213
codeset "github.com/fuseml/fuseml-core/gen/codeset"
1314
gitc "github.com/fuseml/fuseml-core/pkg/client"
1415
goa "goa.design/goa/v3/pkg"
@@ -92,7 +93,7 @@ func main() {
9293
}
9394

9495
if data != nil {
95-
m, _ := json.MarshalIndent(data, "", " ")
96+
m, _ := yaml.Marshal(data)
9697
fmt.Println(string(m))
9798
}
9899
// Pushing the code must be done from client, before passing the request to the server

design/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package design
22

33
import (
4+
_ "github.com/fuseml/fuseml-core/design/cli"
45
. "goa.design/goa/v3/dsl"
56
)
67

0 commit comments

Comments
 (0)