Skip to content

Commit 9cb6261

Browse files
committed
clean up
1 parent 0987eab commit 9cb6261

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

bundle/direct/dresources/adapter.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type IResource interface {
8686

8787
// [Optional] KeyedSlices returns a map from path patterns to KeyFunc for comparing slices by key instead of by index.
8888
// Example: func (*ResourcePermissions) KeyedSlices(state *PermissionsState) map[string]any
89-
KeyedSlices(state any) map[string]any
89+
KeyedSlices() map[string]any
9090
}
9191

9292
// Adapter wraps resource implementation, validates signatures and type consistency across methods
@@ -202,18 +202,7 @@ func loadFieldTriggers(triggerCall *calladapt.BoundCaller, isLocal bool) (map[st
202202

203203
// loadKeyedSlices validates and calls KeyedSlices method, returning the resulting map.
204204
func loadKeyedSlices(call *calladapt.BoundCaller) (map[string]any, error) {
205-
// Validate signature: func(stateType) map[string]any
206-
if len(call.InTypes) != 1 {
207-
return nil, fmt.Errorf("KeyedSlices must take exactly 1 parameter, got %d", len(call.InTypes))
208-
}
209-
expectedReturnType := reflect.TypeOf(map[string]any{})
210-
if len(call.OutTypes) != 1 || call.OutTypes[0] != expectedReturnType {
211-
return nil, fmt.Errorf("KeyedSlices must return map[string]any, got %v", call.OutTypes)
212-
}
213-
214-
// Create a nil pointer of the expected type (KeyedSlices implementations should not depend on the state value)
215-
nilArg := reflect.Zero(call.InTypes[0]).Interface()
216-
outs, err := call.Call(nilArg)
205+
outs, err := call.Call()
217206
if err != nil {
218207
return nil, fmt.Errorf("failed to call KeyedSlices: %w", err)
219208
}

bundle/direct/dresources/permissions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func accessControlRequestKey(x iam.AccessControlRequest) (string, string) {
9898
return "", ""
9999
}
100100

101-
func (*ResourcePermissions) KeyedSlices(s *PermissionsState) map[string]any {
101+
func (*ResourcePermissions) KeyedSlices() map[string]any {
102102
return map[string]any{
103103
"permissions": accessControlRequestKey,
104104
}

0 commit comments

Comments
 (0)