From 3a53163f36f3513cb70594960ace214e9fb9a4e8 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 31 Jul 2023 19:53:29 -0600 Subject: [PATCH] Fixed node interface type resolver --- gql_interfaces.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gql_interfaces.go b/gql_interfaces.go index 06e04bb..45c20f8 100644 --- a/gql_interfaces.go +++ b/gql_interfaces.go @@ -58,10 +58,21 @@ func NodeInterfaceResolveType(required_extensions []ExtType, default_type **grap gql_type, exists := ctx.GQLContext.NodeTypes[node.Result.NodeType] ctx.Context.Log.Logf("gql", "GQL_INTERFACE_RESOLVE_TYPE(%+v): %+v - %t - %+v - %+v", node, gql_type, exists, required_extensions, *default_type) if exists == false { - for _, ext := range(required_extensions) { - _, exists := node.Result.Extensions[ext] - if exists == false { - return nil + node_type_def, exists := ctx.Context.Types[Hash(node.Result.NodeType)] + if exists == false { + return nil + } else { + for _, ext := range(required_extensions) { + found := false + for _, e := range(node_type_def.Extensions) { + if e == ext { + found = true + break + } + } + if found == false { + return nil + } } } return *default_type