Skip to content

Commit

Permalink
Merge e1de0c7 into 8ea8a0e
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulgrover99 authored Jul 9, 2021
2 parents 8ea8a0e + e1de0c7 commit b5e2496
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/docker/docker v17.12.0-ce-rc1.0.20200916142827-bd33bbf0497b+incompatible
github.com/docker/go-units v0.4.0 // indirect
github.com/go-openapi/strfmt v0.19.3 // indirect
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.2
github.com/golang/protobuf v1.5.0
github.com/google/go-cmp v0.5.5
github.com/google/uuid v1.1.2
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.15.2
Expand All @@ -36,7 +36,7 @@ require (
golang.org/x/tools v0.1.0 // indirect
google.golang.org/genproto v0.0.0-20201026171402-d4b8fe4fd877
google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.25.0
google.golang.org/protobuf v1.26.0
gopkg.in/yaml.v2 v2.3.0
gotest.tools v2.2.0+incompatible // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
Expand Down
15 changes: 7 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,17 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
Expand Down Expand Up @@ -737,11 +736,11 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
26 changes: 13 additions & 13 deletions http-server/http_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
tt "text/template"

"github.com/golang/protobuf/jsonpb" // nolint:staticcheck
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"github.com/tinkerbell/tink/pkg"
Expand All @@ -18,6 +17,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/encoding/protojson"
)

// RegisterHardwareServiceHandlerFromEndpoint serves Hardware requests at the
Expand Down Expand Up @@ -366,13 +366,13 @@ func RegisterTemplateHandlerFromEndpoint(ctx context.Context, mux *runtime.Serve
var tmp *template.WorkflowTemplate
err = nil
for tmp, err = list.Recv(); err == nil && tmp.Name != ""; tmp, err = list.Recv() {
m := jsonpb.Marshaler{OrigName: true}
s, err := m.MarshalToString(tmp)
m := protojson.MarshalOptions{UseProtoNames: true}
s, err := m.Marshal(tmp)
if err != nil {
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, s)
writeResponse(w, http.StatusOK, string(s))
}

if err != nil && err != io.EOF {
Expand Down Expand Up @@ -490,13 +490,13 @@ func RegisterWorkflowSvcHandlerFromEndpoint(ctx context.Context, mux *runtime.Se
var wf *workflow.Workflow
err = nil
for wf, err = list.Recv(); err == nil && wf.Id != ""; wf, err = list.Recv() {
m := jsonpb.Marshaler{OrigName: true}
s, err := m.MarshalToString(wf)
m := protojson.MarshalOptions{UseProtoNames: true}
s, err := m.Marshal(wf)
if err != nil {
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, s)
writeResponse(w, http.StatusOK, string(s))
}

if err != nil && err != io.EOF {
Expand Down Expand Up @@ -528,13 +528,13 @@ func RegisterWorkflowSvcHandlerFromEndpoint(ctx context.Context, mux *runtime.Se
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
m := jsonpb.Marshaler{OrigName: true, EmitDefaults: true}
s, err := m.MarshalToString(wfc)
m := protojson.MarshalOptions{UseProtoNames: true, EmitUnpopulated: true}
s, err := m.Marshal(wfc)
if err != nil {
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, s)
writeResponse(w, http.StatusOK, string(s))
})

// workflow events handler | GET /v1/workflows/{id}/events
Expand Down Expand Up @@ -563,13 +563,13 @@ func RegisterWorkflowSvcHandlerFromEndpoint(ctx context.Context, mux *runtime.Se
var event *workflow.WorkflowActionStatus
err = nil
for event, err = events.Recv(); err == nil && event != nil; event, err = events.Recv() {
m := jsonpb.Marshaler{OrigName: true, EmitDefaults: true}
s, err := m.MarshalToString(event)
m := protojson.MarshalOptions{UseProtoNames: true, EmitUnpopulated: true}
s, err := m.Marshal(event)
if err != nil {
writeResponse(w, http.StatusInternalServerError, err.Error())
return
}
writeResponse(w, http.StatusOK, s)
writeResponse(w, http.StatusOK, string(s))
}
if err != nil && err != io.EOF {
writeResponse(w, http.StatusInternalServerError, err.Error())
Expand Down

0 comments on commit b5e2496

Please sign in to comment.