Fixed node interface type resolver

gql_cataclysm
noah metz 2023-07-31 19:53:29 -06:00
parent c515128743
commit 3a53163f36
1 changed files with 15 additions and 4 deletions

@ -58,10 +58,21 @@ func NodeInterfaceResolveType(required_extensions []ExtType, default_type **grap
gql_type, exists := ctx.GQLContext.NodeTypes[node.Result.NodeType] 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) 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 { if exists == false {
for _, ext := range(required_extensions) { node_type_def, exists := ctx.Context.Types[Hash(node.Result.NodeType)]
_, exists := node.Result.Extensions[ext] if exists == false {
if exists == false { return nil
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 return *default_type