refactor getReferences #103

Closed
0xmuralik wants to merge 3 commits from murali/gql into murali/record-attributes
2 changed files with 5 additions and 2 deletions
Showing only changes of commit 3ffff8d992 - Show all commits

View File

@ -19,6 +19,9 @@ test/
tests/ tests/
*_test.go *_test.go
# false positive
testutil/network/network.go
# Semgrep rules folder # Semgrep rules folder
.semgrep .semgrep

View File

@ -170,8 +170,8 @@ func getReferences(ctx context.Context, resolver QueryResolver, r *registrytypes
func getIds(obj map[string]interface{}) []string { func getIds(obj map[string]interface{}) []string {
var ids []string var ids []string
for _, val := range obj { for key := range obj {
if innerObj, ok := val.(map[string]interface{}); ok { if innerObj, ok := obj[key].(map[string]interface{}); ok {
if _, ok := innerObj["/"]; ok && len(innerObj) == 1 { if _, ok := innerObj["/"]; ok && len(innerObj) == 1 {
if _, ok := innerObj["/"].(string); ok { if _, ok := innerObj["/"].(string); ok {
ids = append(ids, innerObj["/"].(string)) ids = append(ids, innerObj["/"].(string))