We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d5296d commit 64a257fCopy full SHA for 64a257f
CHANGELOG.md
@@ -11,6 +11,7 @@
11
- (Bugfix) Fix AnyPB Parsing in Meta Service
12
- (Feature) Add Arch Tolerations
13
- (Bugfix) Enable Platform Operator on EE Chart
14
+- (Feature) Improve GRPC JSON Handling
15
16
## [1.3.0](https://github.com/arangodb/kube-arangodb/tree/1.3.0) (2025年08月01日)
17
- (Feature) (Platform) Storage Debug
integrations/inventory/v1/definition/inventory.go
@@ -37,7 +37,7 @@ func (s *Inventory) JSON() ([]byte, error) {
37
return []byte("{}"), nil
38
}
39
40
- return ugrpc.Marshal(s)
+ return ugrpc.Marshal(s, ugrpc.WithUseProtoNames(true))
41
42
43
func NewArangoDBConfiguration(spec api.DeploymentSpec, status api.DeploymentStatus) *ArangoDBConfiguration {
integrations/inventory/v1/definition/inventory_test.go
@@ -45,6 +45,7 @@ func Test_State_Marshal(t *testing.T) {
45
46
data, err := ugrpc.Marshal(&s, func(in *protojson.MarshalOptions) {
47
in.EmitDefaultValues = true
48
+ in.UseProtoNames = false
49
})
50
require.NoError(t, err)
51
pkg/deployment/resources/config_map_gateway.go
@@ -131,9 +131,8 @@ func (r *Resources) ensureGatewayConfig(ctx context.Context, cachedStatus inspec
131
},
132
Marshaller: ugrpc.Marshal[*pbInventoryV1.Inventory],
133
Options: []util.Mod[protojson.MarshalOptions]{
134
- func(in *protojson.MarshalOptions) {
135
- in.EmitDefaultValues = true
136
- },
+ ugrpc.WithUseProtoNames(true),
+ ugrpc.WithEmitDefaultValues(true),
137
138
139
pkg/deployment/resources/gateway/dynamic.go
@@ -78,7 +78,7 @@ func NodeDynamicConfig(cluster, id string, cds, lds *DynamicConfig) ([]byte, str
78
b.DynamicResources.LdsConfig = v.AsConfigSource()
79
80
81
- data, err := ugrpc.MarshalYAML(&b)
+ data, err := ugrpc.MarshalYAML(&b, ugrpc.WithUseProtoNames(true))
82
if err != nil {
83
return nil, "", nil, err
84
pkg/deployment/resources/gateway/gateway_config.go
@@ -77,7 +77,7 @@ func (c Config) RenderYAML() ([]byte, string, *pbEnvoyBootstrapV3.Bootstrap, err
77
- data, err := ugrpc.MarshalYAML(cfg)
+ data, err := ugrpc.MarshalYAML(cfg, ugrpc.WithUseProtoNames(true))
@@ -90,7 +90,7 @@ func (c Config) RenderCDSYAML() ([]byte, string, *discoveryApi.DiscoveryResponse
90
91
92
93
94
95
96
@@ -103,7 +103,7 @@ func (c Config) RenderLDSYAML() ([]byte, string, *discoveryApi.DiscoveryResponse
103
104
105
106
107
108
109
pkg/util/grpc/http.go
@@ -105,7 +105,7 @@ func Get[T proto.Message](ctx context.Context, client operatorHTTP.HTTPClient, u
func Post[IN, T proto.Message](ctx context.Context, client operatorHTTP.HTTPClient, in IN, url string, mods ...util.Mod[goHttp.Request]) HTTPResponse[T] {
- data, err := Marshal(in)
+ data, err := Marshal(in, WithUseProtoNames(true))
110
return httpErrorResponse[T]{err: err}
111
pkg/util/grpc/marshal.go
@@ -28,10 +28,20 @@ import (
28
"github.com/arangodb/kube-arangodb/pkg/util"
29
)
30
31
-func Marshal[T proto.Message](in T, opts ...util.Mod[protojson.MarshalOptions]) ([]byte, error) {
32
- options := protojson.MarshalOptions{
33
- UseProtoNames: true,
+func WithUseProtoNames(value bool) util.Mod[protojson.MarshalOptions] {
+ return func(in *protojson.MarshalOptions) {
+ in.UseProtoNames = value
34
+ }
35
+}
36
+
+func WithEmitDefaultValues(value bool) util.Mod[protojson.MarshalOptions] {
+ in.EmitDefaultValues = value
+func Marshal[T proto.Message](in T, opts ...util.Mod[protojson.MarshalOptions]) ([]byte, error) {
44
+ options := protojson.MarshalOptions{}
util.ApplyMods(&options, opts...)
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments