Skip to content

Commit 33c2c03

Browse files
authored
[Bugfix] Fix AnyPB Parsing in Meta Service (#1960)
1 parent a9ccccf commit 33c2c03

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- (Feature) Add CA Certificates
99
- (Feature) Chart By Tag filter
1010
- (Feature) Add Gateway Config condition
11+
- (Bugfix) Fix AnyPB Parsing in Meta Service
1112

1213
## [1.3.0](https://github.com/arangodb/kube-arangodb/tree/1.3.0) (2025-08-01)
1314
- (Feature) (Platform) Storage Debug

integrations/meta/v1/impl.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"github.com/arangodb/kube-arangodb/pkg/util"
4040
"github.com/arangodb/kube-arangodb/pkg/util/cache"
4141
"github.com/arangodb/kube-arangodb/pkg/util/errors"
42-
ugrpc "github.com/arangodb/kube-arangodb/pkg/util/grpc"
4342
"github.com/arangodb/kube-arangodb/pkg/util/svc"
4443
)
4544

@@ -129,7 +128,7 @@ func (i *implementation) Set(ctx context.Context, req *pbMetaV1.SetRequest) (*pb
129128
obj.Key = key
130129
obj.Rev = req.Revision
131130

132-
obj.Object = ugrpc.NewGRPC(req.GetObject())
131+
obj.Object.Object = req.GetObject()
133132

134133
if err := i.cache.Put(ctx, key, &obj); err != nil {
135134
if shared.IsPreconditionFailed(err) {

integrations/meta/v1/object.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
2929

3030
pbMetaV1 "github.com/arangodb/kube-arangodb/integrations/meta/v1/definition"
31-
ugrpc "github.com/arangodb/kube-arangodb/pkg/util/grpc"
3231
)
3332

3433
type Object struct {
@@ -37,7 +36,11 @@ type Object struct {
3736

3837
Meta *ObjectMeta `json:"meta,omitempty"`
3938

40-
Object ugrpc.GRPC[*anypb.Any] `json:"object"`
39+
Object ObjectProto `json:"object,omitempty"`
40+
}
41+
42+
type ObjectProto struct {
43+
Object *anypb.Any `json:"Object,omitempty"`
4144
}
4245

4346
func (o *Object) SetKey(s string) {

integrations/meta/v1/service_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package v1
2222

2323
import (
2424
"context"
25+
"encoding/json"
2526
"testing"
2627

2728
"github.com/stretchr/testify/require"
@@ -32,6 +33,29 @@ import (
3233
"github.com/arangodb/kube-arangodb/pkg/util/tests/tgrpc"
3334
)
3435

36+
func Test_Types(t *testing.T) {
37+
z := `{
38+
"meta": {
39+
"updatedAt": "2025-07-07T15:13:09Z"
40+
},
41+
"object": {
42+
"Object": {
43+
"type_url": "type.googleapis.com/arangodb_platform_internal.metadata_store.GenAiProjectNames",
44+
"value": "ChV0ZXN0X3Byb2plY3RfNmVhYWM3MjM="
45+
}
46+
}
47+
}`
48+
49+
var obj Object
50+
51+
require.NoError(t, json.Unmarshal([]byte(z), &obj))
52+
53+
n, err := json.Marshal(obj)
54+
require.NoError(t, err)
55+
56+
require.JSONEq(t, z, string(n))
57+
}
58+
3559
func Handler(t *testing.T, ctx context.Context, mods ...util.ModR[Configuration]) svc.Handler {
3660
handler, err := New(ctx, NewConfiguration().With(mods...))
3761
require.NoError(t, err)

0 commit comments

Comments
 (0)